#include <bits/stdc++.h>

using namespace std;

int main()
{
    cin.tie(nullptr), cout.tie(nullptr), ios::sync_with_stdio(false);

    int n, m; cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    while(m--)
    {
        int q; cin >> q;
        int l = 0, r = n - 1;
        while(l < r)
        {
            int mid = l + r >> 1;
            if(a[mid] < q) l = mid + 1;
            else r = mid;
        }
        if(a[l] == q) cout << l << " ";
        cout << -1 << " ";
    }

    return 0;
}